package com.nosnow.order.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @author by bingHeng
 * @version 1.0
 * @Create 2020/5/29 11:18
 */
public class OrderNoUtil {

    // 获取订单号
    public static String getOrderNo() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        String newDate = simpleDateFormat.format(new Date());
        StringBuilder result = new StringBuilder();
        Random random = new Random();
        for(int i = 0; i < 3; i++) {
            result.append(random.nextInt(10));
        }
        return newDate + result.toString();
    }
}
